(function ($) {

  $(function () {
    $(".ztree").each(function () {
      var ztree = $(this);
      if (ztree.data("asyncUrl")) {
        var settings = {
          async: {
            enable: true,
            url: ztree.data("asyncUrl")
          },
          check: {
            enable: !!ztree.data("checkEnable") && ztree.data("checkEnable") !== "false",
            chkStyle: ztree.data("checkChkStyle") || "checkbox"
          }
        };
      }
      $.fn.zTree.init(ztree, settings);
    });
  });

})(jQuery);
